package com.zuoye3;

import java.util.ArrayList;
import java.util.Objects;
import java.util.Scanner;

public class Student {
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age &&
                Objects.equals(id, student.id) &&
                Objects.equals(name, student.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, age);
    }

    private String id;//学号
    private String name;//姓名
    private int age;//年龄

    @Override
    public String toString() {
        return "学生信息 [id="+ id + ", name=" + name  + ", age=" + age + "]";
    }


    public Student() {

       Scanner sc = new Scanner(System.in);
       System.out.println("请输入学生的学号");
       this.id = sc.nextLine();
       System.out.println("请输入学生的姓名");
       this.name=sc.nextLine();
       System.out.println("请输入学生的年龄");
       this.age=sc.nextInt();
    }


    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}
